#include <gtest/gtest.h>

#include "person.pb.h"

TEST(Protobuf, BasicTest) {
    demo::Person person;
    person.set_name("Alice");
    person.set_id(1234);
    person.set_has_pets(true);

    std::string serialized_data;
    person.SerializeToString(&serialized_data);

    std::cout << "Serialized data: " << serialized_data << std::endl;

    demo::Person parsed_person;
    if (parsed_person.ParseFromString(serialized_data)) {
        std::cout << "Name: " << parsed_person.name() << std::endl;
        std::cout << "Id: " << parsed_person.id() << std::endl;
        std::cout << "Has pets: " << parsed_person.has_pets() << std::endl;
    }
}